﻿using JTParcrelHelper.bean;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BarcodeDelay
{

    public class StoParams
    {
        private static StoParams instance;
        public static StoParams Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new StoParams();
                }
                return instance;
            }
        }

        public bool isInitConfig = false;
        public string register_site { get; set; }
        public string register_code { get; set; }
        public string register_user { get; set; }
        public string register_networkId { get; set; }
        public string contact{ get; set; }
        public string arrival_priorSite { get; set; }
        public string arrival_priorSite_SacnEndTime { get; set; }
        public string db_connstr { get; set; }

        public string register_wechat = "";

        public Hashtable ht_sto_province_day = new Hashtable();
        public string provinceTxtPath = "province.txt";
        public string siteTxtPath = "site.txt";
        public string wechatTxtPath = "WeChatGroupName.txt";
        public string configTxtPath = "confiTimeg.txt";
        public string siteArrTxtPath = "arr.txt";
        public string contactTxtPath = "pool.txt";
        public string checkTxtPath = "check.txt";
        public string templetePath = "templete.txt";
        public string userGroupTxtPath = "userwechat.txt";

        public string siteWechatTxtPath = "SiteWechat.txt";

        public string allRoomsTxtPath = "all-rooms.txt";
       

        public string allRoomsEmplyeeTxtPath = "all-rooms-employee.txt";

        public string allowLanshouRoomsTxtPath = "allow-lanshou-rooms.txt";

        public string forbiddenLanshouRoomsTxtPath = "forbidden-lanshou-rooms.txt";

        public string allSitesTxtPath = "all-sites.txt";


        public string allFilterWechatTxtPath = "all-rooms-filter.txt";

        public string allCustomerServiceTxtPath = "all-customer-wxid.txt";

        public string allDrawWechatTxtPath = "all-rooms-draw.txt";
        public string allCodingWechatTxtPath = "all-rooms-coding.txt";

        public string allInternalUserTxtPath = "all-internal-user.txt";

        public string allLanshouWechatTxtPath = "all-rooms-lanshou.txt";
        public string allGendanWechatTxtPath = "all-rooms-gendan.txt";

        public string allGendanCommandTxtPath = "all-command-gendan.txt";
        public string allDrawCommandTxtPath = "all-command-draw.txt";
        public string allCodingCommandTxtPath = "all-command-coding.txt";

        public string allChangeCodingCommandTxtPath = "all-command-change-coding.txt";


        public string allQuestionCommandTxtPath = "all-command-question.txt";
        public string allCheckCommandTxtPath = "all-command-check.txt";

        public string allVipRoomPath = "vip-rooms.txt";

        

        public string ccPath = "cc.txt";
        public string userPath = "User.txt";
        public string SJPath = "sj.txt";
        public string MainLinePath = "main.txt";
        public string SettingPath = "setting.txt";

        public string SiteWechatPath = "SiteWeChat.txt";

        public string BarcodeSitePath = "barcode-site.txt";
        public string TokenSitePath = "token-site.txt";

        public string WorkOrderSitePath = "inbound-workorder.txt";

        public string OutboundCustomerSitePath = "outbound-sitecustomer.txt";

        public string UniqueWeChatSitePath = "unique-wechat-site.txt";

        public string PosSitePath = "coordinate.txt";

        public string TokenLanshouPath = "token-lanshou.txt";

        public string GroupRoomPath = "all-rooms-group.txt";


        public string NoRoadMapPath = "no-road-map.txt";
        public string ProblemAckSitePath = "问题件回复.xlsx";
        public string EmployeeGroupSitePath = "群客服.xlsx";


        public string LanshouSitePath = "lanshouUrl.txt";

        public string CloseSitePath = "clseRoom.txt";


        public int day_total = 0;
        public int day_left = 0;
        public int user_status = 0;
        public string queryUrl = "";
        public string port = "";
        public string regCode = "";
        public string endDate = "";
        public bool isAssignCheck = false;
        public string version = "5.0";
        public string fileDir = "";
        public string roadFilePath = "";
        public int queryCount = 100;
        public Hashtable htSiteTimeMap = new Hashtable();

        public bool isDbConnect = false;

        public bool isFastMode = false;
        public string currentBarcode = "";
        public string resMsg = "";
        public int totalPages = 0;
        public int curPage = 0;
        public string outputDir = "";
        public bool isUseOperationTime = true;
        public bool isShowReturn = true;
        public bool isShowProblem = true;
        public bool isShowTransfer= true;


        public int totalParcels = 0;
        public int curParces = 0;
        public int addCommentParcels = 0;
        public string curDelayBarcode = "";
        public string curFailedBarcode = "";
        public bool isProcessStop = false;
        public string lastBarcodeScanTime = "";


        public string interResMsg = "";
        public string interBarcode = "";
        public string curInterCeptSuccess = "";

        public string probleTypeSubject = "";

        public bool isServerStart = false;
        public Hashtable htResWechat = new Hashtable();
        public string lastRecvContent = "";

        public string curHandleStep = "";

        public Hashtable htRegInfo = new Hashtable();

        public Hashtable htRegSiteNameAndReg = new Hashtable();


        public Hashtable htRegSiteNameAndToken = new Hashtable();

        public Hashtable htWechatInfo = new Hashtable();

        public Hashtable htDifferentSiteBarcodeInfo = new Hashtable();

        public string lastBarcode = "";
        public ArrayList arListDefineGroupNames = new ArrayList();

        public ArrayList arListDoneTask = new ArrayList();

        public string taskCode = "";
        public string nextStaCode = "457903";

        public string wechatGroupFileDir = "";

        public Hashtable htRegsiteToken = new Hashtable();
        public bool isRegByMachine = false;
        public string regAllSites = "";

        public Hashtable htSpecialSiteWechat = new Hashtable();


        public Hashtable htLanshouSiteUrl = new Hashtable();


        public string scanUrl = @"http://127.0.0.1:8080/OpScan";

        public bool isCuiTypeWhenAssign = true;

        public bool isOnlySiteIntercept = true;
        public bool isTransMore72HourIntercept = false;

        public bool isSimpleStatic = false;

        public bool autoTask = false;

        public bool isWechatListen = true;
        public string replyWechat = "wxid_y379vgku87kn22";

        public string superWechatFlag = "server";

        public string geWePostUrl = "";

        public string geQQGetUrl = "";

        public int speed = 4;

        public int miniSpeed = 4;
        public int maxSpeed = 4;

        public int operateType = 1;
        public int problemFirstType = 0;
        public int problemSecondType = 0;
        public string inboundTemplete = "";

        public Hashtable htFirstProblemType = new Hashtable();

        public Hashtable htSecondProblemType = new Hashtable();
        public SignPrblemType firstProblemBean = new SignPrblemType();
        public SignPrblemType secondProblemBean = new SignPrblemType();
        public Hashtable htTokenSign = new Hashtable();

        public bool isInAddZCProcess = false;

        public bool isZCOperater = false;

        public StringBuilder sbZCAutoAdd = new StringBuilder();

        public int autoSelectedSpeed = 20;
        public string autoMode = "";
        public  object obj_dep = new object();

        public Hashtable htBarcodeResMsg = new Hashtable();
        public object obj_htRes = new object();
        public string httpResmsg = "";

        public string normalBeginExcuteTime = "";

        public bool isStrictMode = false;

        public bool isChangeSuccessLeaveMsg = false;

        public bool isRabbitWin = true;

        public Hashtable htTokenUser = new Hashtable();

        

        public Hashtable htTodayLeaveMsgCount = new Hashtable();

        public Hashtable htLanshouFail = new Hashtable();

        public Hashtable htCommondFilter = new Hashtable();

        public Hashtable htCustomerAndDuty = new Hashtable();
        public Hashtable htAllProblemTypeAck = new Hashtable();

        public string getQQServerIP = "";
        public int getQQServerPort = 0;
        public bool transferQQ = false;


        public bool canLanshou = true;

        public bool isFestivalTime = false;


        public bool returnChange = false;

        public string  ztoRegexStr = "^((768|765|778|779|719|518|880|660|805|718|728|738|761|762|763|701|757|689|738|528)[0-9]{9})$|^2013[0-9]{8}$|^((200)[0-9]{8})$|^(90|91|94|53)[0-9]{10}$|^(120)[0-9]{9}$|^(780)[0-9]{9}$|^(881)[0-9]{9}$|^(6666666666)[0-9]{2}$|^(960)[0-9]{9}$|^665[0-9]{9}$|^(wx|hf)[0-9]{10}$|^(63|64)[0-9]{10}$|^(72)[0-9]{10}$|^731[0-9]{11}$|^73220[0-9]{9}$|^73200[0-9]{9}$|^7518[0-9]{8}$|^73210[0-9]{9}$|^771[0-9]{11}$|^733000[0-9]{8}$|^73211[0-9]{9}$|^(A)[0-9]{9}$|^C[0-9]{9}$|^D[0-9]{9}$|^73222[0-9]{9}$|^734[0-9]{11}$|^75210[0-9]{9}$|^73223[0-9]{9}$|^73224[0-9]{9}$|^8[0-9]{7}$|^688[0-9]{9}$|^68[0-9]{10}$|^882[0-9]{9}$|^010[0-9]{9}$|^628[0-9]{9}$|^E[0-9]{9}$|^F[0-9]{9}$|^G[0-9]{9}$|^H[0-9]{9}$|^7777[0-9]{10}$|^759[0-9]{11}$|^760[0-9]{11}$|^741[0-9]{11}$|^73226[0-9]{9}$|^777600[0-9]{8}$|^77761[0-9]{9}$|^73227[0-9]{9}$|^H[0-9]{9}$|^J[0-9]{9}$|^K[0-9]{9}$|^L[0-9]{9}$|^M[0-9]{9}$|^N[0-9]{9}$|^73225[0-9]{9}$|^31111[0-9]{9}$|^O[0-9]{9}$|^P[0-9]{9}$|^Q[0-9]{9}$|^R[0-9]{9}$|^S[0-9]{9}$|^T[0-9]{9}$|^73228[0-9]{9}$|^73229[0-9]{9}$|^756[0-9]{11}$|^U[0-9]{9}$|^V[0-9]{9}$|^W[0-9]{9}$|^X[0-9]{9}$|^Y[0-9]{9}$|^Z[0-9]{9}$|^[A-Z]{2}[0-9]{8}$|^766[0-9]{11}$|^783[0-9]{11}$|^735[0-9]{11}$|^787[0-9]{11}$|^757[0-9]{11}$|^784[0-9]{11}$|^764[0-9]{11}$|^788[0-9]{11}$|^7361[0-9]{10}$|^7362[0-9]{10}$|^789[0-9]{11}$|^785[0-9]{11}$|^767[0-9]{11}$|^7360[0-9]{10}$|^7363[0-9]{10}$|^7364[0-9]{10}$";
        public string storegexStr = "^(11|22|88)[0-9]{10}$|^(55|66)[0-9]{11}$|^(4)[0-9]{11}$|^(777|773|772|770)[0-9]{12}$|^(7755|7756|7760|7761|7762|7763|7764|7765|7766)[0-9]{11}$|^(WMD)[0-9]{15}$|^(611|621|631|651)[0-9]{12}$";

        public string ytoregexStr = "^(YT)[0-9]{13}$";
        public Hashtable htInternalUserLanshouWord = new Hashtable();
        public Hashtable htInternalUserGendanWord = new Hashtable();

        public void initParam()
        {
            try
            {
                string singType = ConfigurationManager.AppSettings["signProblemCuiTypeWhenAssign"];
                isCuiTypeWhenAssign = Convert.ToBoolean(singType);


                string signProblemMore72HourTransSiteIntercept = ConfigurationManager.AppSettings["signProblemMore72HourTransSiteIntercept"];
                isTransMore72HourIntercept = Convert.ToBoolean(signProblemMore72HourTransSiteIntercept);
                isSimpleStatic= Convert.ToBoolean(ConfigurationManager.AppSettings["simpleStatic"]);
                autoTask= Convert.ToBoolean(ConfigurationManager.AppSettings["autoTask"]);
                isWechatListen = Convert.ToBoolean(ConfigurationManager.AppSettings["listenWechat"]);
                replyWechat= ConfigurationManager.AppSettings["replySuperWechat"];
                superWechatFlag= ConfigurationManager.AppSettings["superWechatFlag"];
                geWePostUrl= ConfigurationManager.AppSettings["geWechatServer"];

                isInitConfig = true;
           
                //isRabbitWin = Convert.ToBoolean(ConfigurationManager.AppSettings["isRabbitWin"]);
                isStrictMode = Convert.ToBoolean(ConfigurationManager.AppSettings["isStrictMode"]);
                isChangeSuccessLeaveMsg= Convert.ToBoolean(ConfigurationManager.AppSettings["isChangeSuccessLeaveMsg"]);
                geQQGetUrl = ConfigurationManager.AppSettings["geQQGetServer"];

                canLanshou = Convert.ToBoolean(ConfigurationManager.AppSettings["canLanshou"]);


                isFestivalTime = Convert.ToBoolean(ConfigurationManager.AppSettings["springFestival"]);

                getQQServerIP = ConfigurationManager.AppSettings["QQMsgTransferServer"];
                getQQServerPort= Convert.ToInt32(ConfigurationManager.AppSettings["QQMsgTransferPort"]);

                string strTransferQQ = ConfigurationManager.AppSettings["transferQQ"];
                transferQQ= Convert.ToBoolean(ConfigurationManager.AppSettings["strTransferQQ"]);
                returnChange= Convert.ToBoolean(ConfigurationManager.AppSettings["returnChange"]);

            }
            catch(Exception ex)
            {

            }
        }

        public void initFilter()
        {
            htCommondFilter["解析到任务设置留言微信成功"] = "";
            htCommondFilter["注册网点成功"] = "";
        }



    }
}
